package com.blb.service.impl;

import com.blb.entity.Printer;
import com.blb.mapper.PrinterMapper;
import com.blb.service.IPrinterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author HuaHao
 * @since 2019-11-14
 */
@Service
public class PrinterServiceImpl extends ServiceImpl<PrinterMapper, Printer> implements IPrinterService {
    @Resource
    private PrinterMapper printerMapper;

    /**
     * 查询所有的打印机名称
     * @return
     */
    @Override
    public List<String> findAllPrinterName(String companyId) {
        return printerMapper.findAllPrinterName(companyId);
    }

    /**
     * 模糊查询
     * @return
     */
    @Override
    public List<Printer> findbynum(Integer start, Integer length, String pnum,String companyId) {
        return printerMapper.findbynum(start,length,pnum,companyId);
    }

    @Override
    public int count(String pnum,String companyId) {
        return printerMapper.count(pnum,companyId);
    }

    @Override
    public Printer getname(String companyid, String pNum) {
        return printerMapper.getname(companyid,pNum);
    }


    /**
     * 添加打印机
     * @param printer
     */
    @Override
    public void addPrinter(Printer printer) {
      printerMapper.addPrinter(printer);
    }

    /**
     * 删除
     * @param id
     */
    @Override
     public void deletePrinter(String id) {
        printerMapper.deletePrinter(id);
    }

    /**
     * 通过id进行查找
     * @param id
     * @return
     */
    @Override
     public Printer findbyid(String id) {

        return printerMapper.findbyid(id);
    }

    /**
     *修改
     * @param printer
     */
     @Override
    public void update(Printer printer) {
     printerMapper.updatePrinter(printer);
    }


}


